//! \file UiKeyboard.c
//! \brief TODO: Document
// -----------------------------------------------------------------------------
//! This program is free software; you can redistribute it and/or
//! modify it under the terms of the GNU General Public License
//! as published by the Free Software Foundation; either version 2
//! of the License, or (at your option) any later version.
//!
//! This program is distributed in the hope that it will be useful,
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//! GNU General Public License for more details.
//!
//! You should have received a copy of the GNU General Public License
//! along with this program; if not, write to the Free Software Foundation,
//! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// -----------------------------------------------------------------------------

#include "UiKeyboard.h"
#include "Core.h"

#include <SDL/SDL.h>
#include <vector>
using namespace std;

// =====[ Local Definitions ]===================================================

// =====[ Local DataTypes ]=====================================================


typedef struct
{
  SDLKey Key;             //!< TODO: document
  SDLMod Mod;             //!< TODO: document
  tKeyCallback pCallback; //!< TODO: document
} tKeyEntry;

// =============================================================================
//! \typedef tKEY_ENTRY
//! \brief TODO: document
// -----------------------------------------------------------------------------
typedef tKeyEntry* tKEY_ENTRY;

// =====[ Local Variables ]=====================================================
vector<tKeyEntry> EntryArray;

// =====[ Local Functions ]=====================================================

// =====[ Private (Internal) Methods ]==========================================

// =====[ Local Implementation ]================================================


// =============================================================================
// Implement: UI_KeyboardBindKey
// -----------------------------------------------------------------------------
tERROR UI_KeyboardBindKey(SDLKey Key, SDLMod Mod, tKeyCallback pCallback)
{
  tKeyEntry Entry;

  // Validate our arguments.
  if (pCallback == NULL) { return (dERROR_INVALID_ARGUMENT); }

  // Populate the entry structure.
  Entry.Key = Key;
  Entry.Mod = Mod;
  Entry.pCallback = pCallback;

  // Append the entry to the entry array.
  EntryArray.push_back(Entry);

  // Finally, return success/

//  tKEY_ENTRY pEntry;
//
//  // Validate our arguments.
//  if (pCallback == NULL) { return (1); } // TODO: update with proper error code.
//
//  // Allocate a new key entry.
//  pEntry = Core_Malloc(sizeof(tKeyEntry));
//  if (pEntry == NULL) { return (1); }  // TODO: update with proper error code.
//
//  // Populate our key entry with the requested values.
//  pEntry->Key = Key;
//  pEntry->Mod = Mod;
//  pEntry->pCallback = pCallback;
//  pEntry->pNext = NULL;
//
//  // Update the current tail to point to the new entry.
//  if (pTail != NULL) { pTail->pNext = pEntry; }
//
//  // Make the new entry the new tail.
//  pTail = pEntry;

  return (0); // TODO: fix error code.
}



